home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 20 / Cream of the Crop 20 (Terry Blount) (1996).iso / program / n_b_v203.zip / INTRNATS.TXT < prev    next >
Text File  |  1996-07-04  |  6KB  |  110 lines

  1. $if 0
  2.     ┌──────────────────────────╖                        PowerBASIC v3.20
  3.  ┌──┤          DASoft          ╟──────────────────────┬──────────────────╖
  4.  │  ├──────────────────────────╢    Copyright 1995    │ DATE: 1995-10-01 ╟─╖
  5.  │  │ FILE NAME   INTRNATS.TXT ║          by          ╘════════════════─ ║ ║
  6.  │  │                          ║  Don Schullian, Jr.                     ║ ║
  7.  │  ╘══════════════════════════╝                                         ║ ║
  8.  │ A license is hereby granted to the holder to use this source code in  ║ ║
  9.  │ any program, commercial or otherwise,  without receiving the express  ║ ║
  10.  │ permission of the copyright holder and without paying any royalties,  ║ ║
  11.  │ as long as this code is not distributed in any compilable format.     ║ ║
  12.  │  IE: source code files, PowerBASIC Unit files, and printed listings   ║ ║
  13.  ╘═╤═════════════════════════════════════════════════════════════════════╝ ║
  14.    │                ....................................                   ║
  15.    ╘═══════════════════════════════════════════════════════════════════════╝
  16. $endif
  17.  
  18. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  19. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  20.  
  21. Several functions in this library provide international support. DOS, too,
  22. provides some of this support but stops VERY short of doing a complete job.
  23. If DOS supports the particular country you need, then it will provide you
  24. with all the information you need to use all these routines except the lower
  25. case conversion table.
  26.  
  27. The only time you need to change the system's country code is if your
  28. program requires the use of fUCASEchar?, fUCASEdos$ or UCASEdos for ASCII
  29. codes > 127. If you do this, however, please don't forget to set it back to
  30. it's original settings before ending your program:)
  31.  
  32. As all of these routines can be found on page 11 of the help menu and that
  33. most of them are very straight forward anyhow I will not go into lengthy
  34. explanations here. The only thing that MAY become confusing is the casing
  35. routines and how they work. Regardless of whose casing routines you use,
  36. PowerBASIC, DOS, or ours, the characters < CHR$(128) are considered standard
  37. ASCII and will always be treated the same. It is the last half of the ASCII
  38. set that changes with each country.
  39.  
  40. PowerBASIC's UCASE$ and LCASE$ seem to be fixed to the 437(US) code page.
  41. DOS's UCASE routines seem to be fixed with whichever country the user has
  42. loaded at start-up.
  43.  
  44. Our routines default to 437(US) to match PowerBASIC but can be changed at
  45. any time by sending a 128 character string with the "converted" letters in
  46. the position of the characters to be changed. The 3 strings below use the
  47. lower ASCII values to demonstrate how Upper$ and Lower$ need to be built
  48. before calling SetUpperCase and SetLowerCase. Of course the real thing will
  49. start with CHR$(128) and proceed through CHR$(255).
  50.  
  51. ASCII="789;:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz"
  52. U$   ="789;:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`ABCDEFGHIJKLMNOPQRSTUVWXYZ"
  53. L$   ="789;:<=>?@abcdefghijklmnopqrstuvwxyz[\]^_`abcdefghijklmnopqrstuvwxyz"
  54.  
  55.  
  56. fSetCountry%                                            ┌─ DOS support
  57. fGetCountry$      CountryCodeTYPE                       │
  58. fGetCollate$      fGetUCASE$                            │
  59. fUCASEchar?       fUCASEdos$          UCASEdos          │
  60. '───────────────────────────────────────────────────────┤
  61. pbvUsingChrs                                            ├─ PowerBASIC
  62. '───────────────────────────────────────────────────────┤
  63. SetUpperCase      fUCASE$             UCASEstr          │
  64. SetLowerCase      fLCASE$             LCASEstr          │
  65. SetMoneyMask      fMoney$                               │
  66. SetDateFormat     all DASsoft date$ routines            │
  67. SetTimeFormat     all DASsoft time$ routines            └─ DASoft routines
  68.  
  69. It is NOT mandatory that your programs conform to DOS's idea of which
  70. countries are to be supported! Many countries that are NOT supported by DOS
  71. and the code pages have their own routines that load their characters, key-
  72. board drivers, code pages, etc. By building a small data-base of this info
  73. or by allowing your users the opportunity to make their own choices your
  74. programs can service almost everyone, everywhere!
  75.  
  76. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  77. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  78. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  79. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  80.  
  81. Try this code at the top of your programs:
  82.  
  83. PUBLIC pCollate$                              ' so it can be used everywhere
  84. SetupCCstuff
  85.  
  86. SUB SetupCCstuff () LOCAL PUBLIC
  87.   LOCAL U$
  88.  
  89.   DIM tCC AS CountryCodeTYPE
  90.   LSET tCC  = fGetCountry$( 0 )                 ' current setting
  91.   U$        = fGetUCASE$                        ' DOS's ucase   128 chars
  92.   pCollate$ = fGetCollate$                      ' DOS's collate 256 chars
  93.   MID$( pbvUsingChrs, 3, 2 ) = CHR$(tCC.ThousandSep, tCC.DecimalSep)
  94.   SetDateFormat tCC.DateFormat , tCC.DateSep
  95.   SetTimeFormat tCC.TimeFormat , tCC.TimeSep
  96.   SetMoneyMask  tCC.MoneySymbol, tCC.MoneyFormat, tCC.MoneyDecs
  97.   SetUpperCase  U$
  98.  
  99. END SUB
  100.  
  101. '.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°.°
  102. ' ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° ° °
  103.  
  104. PowerBASIC does provide an easy way to UCASE and/or LCASE a string.
  105.  
  106. pLower$ = "abcdefghijklmnopqrstuvwxyz"               ' public variables
  107. pUpper$ = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"               '
  108. REPLACE ANY pLower$ WITH pUpper$ IN Txt$             ' ucase
  109. REPLACE ANY pUpper$ WITH pLower$ IN Txt$             ' lcase
  110.